package com.chrissy.music.common.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Johnson
 */
@ConfigurationProperties(prefix = "aliyun.oss")
@Data
@Configuration
public class OssConfig {

    private String endpoint;

    private String bucket;

    private String accessKey;

    private String secretKey;

    private String marketHost;

    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(endpoint, accessKey, secretKey);
    }

}
